<?php
require(dirname(dirname(dirname(__FILE__))) . '/core.php');

if(!empty($_SERVER['HTTP_REFERER']) && !isset($_GET['code']) && !isset($_GET['ref'])){
    header("location:/wap/tmpl/member/login.php?ref=" . urlencode($_SERVER['HTTP_REFERER']));
    exit;
}
?>

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="format-detection" content="telephone=no"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1" />
    <title>登陆/注册</title>
    <link rel="stylesheet" type="text/css" href="/wap/e_tpl/css/base.css">
    <link rel="stylesheet" type="text/css" href="/wap/e_tpl/css/nctouch_member.css">
    <link rel="stylesheet" type="text/css" href="/wap/css/font-awesome.min.css">
</head>
<body>
<header id="header">
    <div class="header-wrap">
        <div class="header-l"> </div>
        <div class="header-title">
            <h1>登陆/注册</h1>
        </div>
    </div>
</header>


<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
//只有是微信访问的情况下，以下设置才生效
if (strpos($user_agent, 'MicroMessenger') === false) {
    ?>
    <div class="nctouch-main-layout">
        <div class="nctouch-inp-con">
            <form action="" method ="">
                <ul class="form-box">

                    <li class="form-item">
                        <h4>手&nbsp;机&nbsp;号</h4>
                        <div class="input-box">
                            <input type="text" id="mobile" name="mobile" class="inp" autocomplete="off" maxlength="11" placeholder="输入手机号" oninput="writeClear($(this));" onfocus="writeClear($(this));" pattern="[0-9]*"/>
                            <span class="input-del code"></span> <span class="code-countdown" style=" display: none;">
            <p>（等待<em>59</em>秒后）</p>
            <p>重新获取验证码</p>
            </span> <span class="code-again" style=""><a id="send" href="javascript: void(0);">获取短信验证</a></span> </div>
                    </li>
                    <li class="form-item">
                        <h4>验&nbsp;证&nbsp;码</h4>
                        <div class="input-box">
                            <input type="text" id="captcha" name="captcha" maxlength="4" size="10" class="inp" autocomplete="off" placeholder="输入图形验证码" oninput="writeClear($(this));"/>
                            <span class="input-del code"></span> <a href="javascript:void(0)" id="refreshcode" class="code-img"><img border="0" id="codeimage" name="codeimage"></a>
                            <input type="hidden" id="codekey" name="codekey" value="">
                        </div>
                    </li>
                </ul>
            </form>
            <form action="" method ="">
                <ul class="form-box mt5">
                    <li class="form-item">
                        <h4>动&nbsp;态&nbsp;码</h4>
                        <div class="input-box">
                            <input type="text" id="auth_code" readonly=true name="auth_code" class="inp" maxlength="6" placeholder="输入短信动态验证码" oninput="writeClear($(this));" onfocus="writeClear($(this));" pattern="[0-9]*"/>
                            <span class="input-del"></span> </div>
                    </li>
                </ul>
                <div class="error-tips"></div>
                <div class="form-btn"><a href="javascript:void(0);" class="btn" id="nextform">登陆/注册</a></div>
            </form>
            <div class="register-mobile-tip">已注册用户登陆。未注册用户直接注册</div>
        </div>
    </div>
    <?php
}
else{
    ?>
    <div style="text-align: center;margin-top:30px;">
        <?php
        if (isset($_GET['from_domain']) && function_exists("tml") && tml('member')->count($_GET['from_domain'])) {
            $src = "/distribute/wechat_qrcode.php?code=335236{$_GET['from_domain']}";
        }
        else{
            $src = "/distribute/wechat_qrcode.php?code=179317{$_COOKIE['from_member']}";
        }
        ?>
        <img width="80%" src='<?php echo $src ?>'>
        <p>
            请先长按二维码识别关注公众号
        </p>
    </div>
    <?php
}
?>
<script>
    var last_ref = '<?php echo urldecode($_GET['ref'])?>';
</script>

<footer id="footer" class="bottom"></footer>
<script type="text/javascript" src="/wap/e_tpl/js/config.js"></script>
<script type="text/javascript" src="/wap/e_tpl/js/zepto.min.js"></script>
<script type="text/javascript" src="/wap/e_tpl/js/template.js"></script>
<script type="text/javascript" src="/wap/e_tpl/js/common.js"></script>
<script type="text/javascript" src="/wap/e_tpl/js/simple-plugin.js"></script>
<script type="text/javascript" src="/wap/e_tpl/js/tmpl/member_mobile_login.js"></script>
<script type="text/javascript" src="/wap/e_tpl/js/tmpl/footer.js"></script>
</body>
</html>
